package com.study.controller;

import com.study.pojo.User;
import com.study.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("user")
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("getUser")
    @ResponseBody
    public User getUserByKey(Integer id){
        return userService.selectByPrimaryKey(id);
    }
    @RequestMapping("getAllUser")
    @ResponseBody
    public List<User> getAllUser(){
        return userService.selectForList(null);
    }
}
